import { LeaveWord } from "@/api/interface/leaveWord";
import { LeaveWordState } from "@/redux/interface";
import * as types from "@/redux/mutation-types";
import produce from "immer";

export type LeaveWordAction = {
	type: "SET_LEAVEWORD_LIST";
	payload: LeaveWord[];
};

const initState: LeaveWordState = {
	leaveWordList: []
};

export default function leaveWord(state: LeaveWordState = initState, action: LeaveWordAction) {
	return produce(state, draftState => {
		switch (action.type) {
			case types.SET_LEAVEWORD_LIST:
				draftState.leaveWordList = action.payload;
				break;

			default:
				break;
		}
	});
}
